from setting import *
import time
from lib.PowerUART import PowerUART

uart1 = PowerUART(seq=1, baudrate=9600, txPin=POWER_PIN_UART1_TX, rxPin=POWER_PIN_UART1_RX,bits=8, stop=1)
 
while True:
    print("111")
    uart1.write(uart1.assemble_frame_data_taojingchi('t0.txt="Hello World!"'))
    uart1.write(uart1.assemble_frame_data_taojingchi('n0.val=54321'))
    while(uart1.any()):     
        data = uart1.read()
        result =uart1.parse_frame_data(data)
        if (result[0] == None ):
          print(result[1])
        else:
          print(result[0].decode('UTF-8'))
    time.sleep_ms(500)
    

